package org.example.resolver;

import graphql.kickstart.tools.GraphQLQueryResolver;
import lombok.Setter;
import org.example.entity.Page;
import org.example.entity.PageInput;
import org.example.entity.Todo;
import org.example.service.TodoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import java.util.List;

@Component
@Setter(onMethod_ = @Autowired)
@Validated
public class TodoResolver implements GraphQLQueryResolver {
    private TodoService todoService;
    public Page todoList(String status, String keyWord, PageInput pageInput){
        return todoService.findByStatus(status, 0,keyWord,pageInput);
    }
    //查看回收站
    public List<Todo> recycle(){
        return todoService.findByDeleted();
    }

}
